package dao.impl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import dao.AccountCategoryDAO;
import domain.AccountCategory;

/**
 * 账目分类Dao实现类.
 * <p>
 * 创建日期：2010-07-01<br>
 * 创建人：Xiyt<br>
 * 修改日期：<br>
 * 修改人：<br>
 * 修改内容：<br>
 * 
 * @author Xiyt
 * @version 1.0
 */
public class AccountCategoryDAOImpl extends SqlMapClientDaoSupport implements AccountCategoryDAO {

	/**
     * 构造方法
     * @author xiyt
     */
    public AccountCategoryDAOImpl() {
        super();
    }

    /**
     * 根据主键查询对象
     * @param accountCategory 对象
     * @author xiyt
     */
    public AccountCategory selectByPrimaryKey(int id) {
    	AccountCategory record = (AccountCategory) getSqlMapClientTemplate().queryForObject("an_account_category.selectByPrimaryKey", id);
    	return record;
    }
    
    /**
     * 根据条件查询对象列表
     * @param accountCategory 对象
     * @author xiyt
     */
    @SuppressWarnings("unchecked")
	public List<AccountCategory> selectByCriteria(AccountCategory accountCategory){
    	List<AccountCategory> list = (List<AccountCategory>)getSqlMapClientTemplate().queryForList("an_account_category.selectByCriteria", accountCategory);
        return list;
    }
    
    
    /**
     * 根据条件查询对象列表
     * @param accountCategory 对象
     * @param start 开始行号
     * @param limit 每次查询行数
     * @author xiyt
     */
    @SuppressWarnings("unchecked")
	public List<AccountCategory> selectByCriteriaForPaging(AccountCategory accountCategory, int start, int limit){
    	List<AccountCategory> list = (List<AccountCategory>)getSqlMapClientTemplate().queryForList("an_account_category.selectByCriteria", accountCategory, start, limit);
        return list;
    }
    
    /**
     * 根据条件查询对象个数
     * @param accountCategory 查询条件对象
     * @author xiyt
     */
    public int countByCriteria(AccountCategory accountCategory){
    	Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("an_account_category.countByCriteria", accountCategory);
        return count;
    }

    /**
     * 插入对象
     * @param accountCategory 对象
     * @author xiyt
     */
    public void insert(AccountCategory accountCategory){
    	getSqlMapClientTemplate().insert("an_account_category.insert", accountCategory);
    }

    /**
     * 根据条件更新对象
     * @param accountCategory 对象
     * @author xiyt
     */
    public int updateByPrimaryKey(AccountCategory accountCategory){
    	int rows = getSqlMapClientTemplate().update("an_account_category.updateByPrimaryKey", accountCategory);
        return rows;
    }
    

    /**
     * 根据条件删除对象个数
     * @param accountCategory 查询条件对象
     * @author xiyt
     */
    public int deleteByPrimaryKey(int id){
    	int rows = getSqlMapClientTemplate().delete("an_account_category.deleteByPrimaryKey", id);
        return rows;
    }
}